<template>
  <div class="goods-container">

    <el-row>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          主页
        </el-breadcrumb-item>
        <el-breadcrumb-item>
          商品管理
        </el-breadcrumb-item>
        <el-breadcrumb-item>
          商品信息
        </el-breadcrumb-item>
      </el-breadcrumb>
    </el-row>
    <el-row>
      搜索
    </el-row>
    <el-row>
      <el-table
          :data="data.list"
          border stripe show-header
      >
        <el-table-column type="selection"></el-table-column>
        <el-table-column type="index"></el-table-column>
        <el-table-column prop="name" label="商品名称"></el-table-column>
        <el-table-column prop="pic" label="商品图片">

           <template #default="scope">
             <img :src="scope.row.pic" alt="pic">
           </template>

        </el-table-column>
        <el-table-column label="标签">
            <template #default="scope">
              上架： <el-switch v-model="scope.row.shelved" />
            </template>
        </el-table-column>
        <el-table-column label="操作">
          <template #default="scope">
            <el-row>
              <el-button type="success">上架</el-button>
              <el-button type="info">下架</el-button>
            </el-row>

            <el-row>
              <el-button type="warning">修改</el-button>
              <el-button type="danger">移除</el-button>
            </el-row>
          </template>
        </el-table-column>
      </el-table>
    </el-row>


  </div>
</template>

<script lang="ts" setup>

import {reactive,onMounted} from "vue";
import request from '@/utils/request.ts'

const data =reactive({
  list: new Array<Object>()
})


onMounted(() => {
    request({
        url:'/goods/list',
        method:'get'
    }).then((res:any)=>{

        data.list = res.data.data;

    })

})


</script>

<style scoped>

  img {
       width: 60px;
  }

</style>